<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>样式问题 | 学习笔记</title><meta name="author" content="lzoxun"><meta name="copyright" content="lzoxun"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="CSS初始化normalize.cssreser.css 只在火狐生效12345@-moz-document url-prefix()&amp;#123;    .box&amp;#123;        color:#f00; &#x2F;&#x2F;box只在火狐浏览器上变红    &amp;#125;&amp;#125;  毛玻璃效果 backdrop-filter 不支持火狐  123bakcground:rgba(255,255,255,">
<meta property="og:type" content="article">
<meta property="og:title" content="样式问题">
<meta property="og:url" content="http://example.com/2023/07/22/web/issues/issues-style/index.html">
<meta property="og:site_name" content="学习笔记">
<meta property="og:description" content="CSS初始化normalize.cssreser.css 只在火狐生效12345@-moz-document url-prefix()&amp;#123;    .box&amp;#123;        color:#f00; &#x2F;&#x2F;box只在火狐浏览器上变红    &amp;#125;&amp;#125;  毛玻璃效果 backdrop-filter 不支持火狐  123bakcground:rgba(255,255,255,">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png">
<meta property="article:published_time" content="2023-07-22T07:14:09.693Z">
<meta property="article:modified_time" content="2023-07-22T07:14:09.693Z">
<meta property="article:author" content="lzoxun">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="http://example.com/2023/07/22/web/issues/issues-style/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.xml","preload":true,"top_n_per_article":1,"unescape":true,"languages":{"hits_empty":"找不到您查询的内容：${query}","hits_stats":"共找到 ${hits} 篇文章"}},
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#1f1f1f","position":"bottom-left"},
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: true,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: false,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '样式问题',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2023-07-22 15:14:09'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
    win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
      const link = document.createElement('link')
      link.rel = 'stylesheet'
      link.href = url
      if (id) link.id = id
      link.onerror = reject
      link.onload = link.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        link.onload = link.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(link)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          const now = new Date()
          const hour = now.getHours()
          const isNight = hour <= 6 || hour >= 18
          if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
          else if (t === 'light') activateLightMode()
          else activateDarkMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 6.3.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><script>(()=>{
  const $loadingBox = document.getElementById('loading-box')
  const $body = document.body
  const preloader = {
    endLoading: () => {
      $body.style.overflow = ''
      $loadingBox.classList.add('loaded')
    },
    initLoading: () => {
      $body.style.overflow = 'hidden'
      $loadingBox.classList.remove('loaded')
    }
  }

  preloader.initLoading()
  window.addEventListener('load',() => { preloader.endLoading() })

  if (false) {
    document.addEventListener('pjax:send', () => { preloader.initLoading() })
    document.addEventListener('pjax:complete', () => { preloader.endLoading() })
  }
})()</script><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src= "" data-lazy-src="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">108</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">1</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><hr class="custom-hr"/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header"><nav id="nav"><span id="blog-info"><a href="/" title="学习笔记"><span class="site-name">学习笔记</span></a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search" href="javascript:void(0);"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">样式问题</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-07-22T07:14:09.693Z" title="发表于 2023-07-22 15:14:09">2023-07-22</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-07-22T07:14:09.693Z" title="更新于 2023-07-22 15:14:09">2023-07-22</time></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="样式问题"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h4 id="CSS"><a href="#CSS" class="headerlink" title="CSS"></a>CSS</h4><h4 id="初始化"><a href="#初始化" class="headerlink" title="初始化"></a>初始化</h4><p>normalize.css<br><a target="_blank" rel="noopener" href="https://meyerweb.com/eric/tools/css/reset/index.html">reser.css</a></p>
<h4 id="只在火狐生效"><a href="#只在火狐生效" class="headerlink" title="只在火狐生效"></a>只在火狐生效</h4><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">@-moz-document</span> url-prefix()&#123;</span><br><span class="line">    <span class="selector-class">.box</span>&#123;</span><br><span class="line">        <span class="attribute">color</span>:<span class="number">#f00</span>; //box只在火狐浏览器上变红</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="毛玻璃效果"><a href="#毛玻璃效果" class="headerlink" title="毛玻璃效果"></a>毛玻璃效果</h4><blockquote>
<p>backdrop-filter 不支持火狐</p>
</blockquote>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">bakcground:<span class="built_in">rgba</span>(<span class="number">255</span>,<span class="number">255</span>,<span class="number">255</span>,.<span class="number">1</span>);</span><br><span class="line"><span class="attribute">box-shadow</span>: <span class="number">0</span> <span class="number">3px</span> <span class="number">1px</span> -<span class="number">2px</span> <span class="built_in">rgba</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0.2</span>), <span class="number">0</span> <span class="number">2px</span> <span class="number">2px</span> <span class="number">0</span> <span class="built_in">rgba</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0.14</span>), <span class="number">0</span> <span class="number">1px</span> <span class="number">5px</span> <span class="number">0</span> <span class="built_in">rgba</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0.12</span>);</span><br><span class="line">backdrop-<span class="attribute">filter</span>:<span class="built_in">blur</span>(<span class="number">20px</span>);</span><br></pre></td></tr></table></figure>
<h4 id="溢出省略"><a href="#溢出省略" class="headerlink" title="溢出省略"></a>溢出省略</h4><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">//单行</span><br><span class="line"><span class="attribute">overflow</span>: hidden;</span><br><span class="line"><span class="attribute">text-overflow</span>:ellipsis;</span><br><span class="line"><span class="attribute">white-space</span>: nowrap;</span><br><span class="line"></span><br><span class="line">//多行</span><br><span class="line"><span class="attribute">display</span>: -webkit-box;</span><br><span class="line">-webkit-box-orient: vertical;</span><br><span class="line">-webkit-line-clamp: <span class="number">3</span>;</span><br><span class="line"><span class="attribute">overflow</span>: hidden;</span><br></pre></td></tr></table></figure>
<h4 id="IOS滚动滑动不顺畅问题"><a href="#IOS滚动滑动不顺畅问题" class="headerlink" title="IOS滚动滑动不顺畅问题"></a>IOS滚动滑动不顺畅问题</h4><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">overflow</span>:auto;</span><br><span class="line">-webkit-<span class="attribute">overflow</span>-scrolling:touch;</span><br></pre></td></tr></table></figure>
<h4 id="隐藏谷歌滚动条"><a href="#隐藏谷歌滚动条" class="headerlink" title="隐藏谷歌滚动条"></a>隐藏谷歌滚动条</h4><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.ele</span>::-webkit-scrollbar&#123;</span><br><span class="line">    <span class="attribute">display</span>:none;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h4 id="格式化上下文-BFC"><a href="#格式化上下文-BFC" class="headerlink" title="格式化上下文 BFC ?"></a>格式化上下文 BFC ?</h4><p>BFC全称是<code>Block Formatting Context</code>，意思就是块级格式化上下文。</p>
<p>你可以把BFC看做一个容器，容器里边的子元素不会影响到容器外部的元素。</p>
<ul>
<li><p>触发方式：父级设置 position、overflow、dispaly、float  这些属性不为默认值</p>
</li>
<li><p>解决问题：</p>
<ul>
<li><p>margin 塌陷&#x2F;重绘&#x2F;重叠，</p>
</li>
<li><p>子元素设置margintop，父元素一起下去</p>
</li>
<li><p>清除浮动</p>
</li>
</ul>
</li>
</ul>
<h4 id="顶线、中线、基线…"><a href="#顶线、中线、基线…" class="headerlink" title="顶线、中线、基线…"></a>顶线、中线、基线…</h4><blockquote>
<p>顶线、中线、基线、底线、行高、行距、半行距 </p>
</blockquote>
<p><a target="_blank" rel="noopener" href="https://www.jianshu.com/p/59f31a1704de">https://www.jianshu.com/p/59f31a1704de</a></p>
<h4 id="图片地部3像素"><a href="#图片地部3像素" class="headerlink" title="图片地部3像素"></a>图片地部3像素</h4><blockquote>
<p>产生原因:img属于<code>linlie</code>元素，div中的img的vertical-align默认属性是<code>baseline</code>,而baseline和底线之间有偏差<br>偏差大小由<code>字体大小</code>而定<br>所有可以从这几个方面处理</p>
</blockquote>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*父元素*/</span></span><br><span class="line"><span class="attribute">font-size</span>: <span class="number">0</span>;</span><br><span class="line"></span><br><span class="line">或<span class="selector-tag">img</span></span><br><span class="line"></span><br><span class="line"><span class="attribute">display</span>:block|inline-black;</span><br><span class="line"></span><br><span class="line">或<span class="selector-tag">img</span></span><br><span class="line"></span><br><span class="line">virtical-align: middle;//设置为任意值都可以</span><br></pre></td></tr></table></figure>
<h4 id="cale动态计算值"><a href="#cale动态计算值" class="headerlink" title="cale动态计算值"></a><code>cale</code>动态计算值</h4><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">width</span>:<span class="built_in">cale</span>(<span class="number">50%</span> - <span class="number">20px</span>);</span><br></pre></td></tr></table></figure>
<h4 id="css隐藏元素的方法"><a href="#css隐藏元素的方法" class="headerlink" title="css隐藏元素的方法"></a>css隐藏元素的方法</h4><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">display</span>:none;</span><br><span class="line">opcity:<span class="number">0</span>;</span><br><span class="line"><span class="attribute">visibility</span>:hidden;（仍然占用空间）</span><br><span class="line">各种方法搞到显示区域之外;</span><br><span class="line"></span><br><span class="line">缩放方式</span><br><span class="line"><span class="attribute">width</span> and <span class="attribute">height</span>:<span class="number">0</span>;</span><br><span class="line"><span class="attribute">transform</span>: <span class="built_in">scale</span>(<span class="number">0</span>);</span><br><span class="line">zoom: <span class="number">0.00001</span>;</span><br></pre></td></tr></table></figure>
<h4 id="清除浮动"><a href="#清除浮动" class="headerlink" title="清除浮动"></a>清除浮动</h4><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/* 1、最后加元素 或 伪元素:after clear: both;*/</span></span><br><span class="line"></span><br><span class="line"><span class="comment">/* 2 display*/</span></span><br><span class="line"><span class="selector-class">.parent</span>&#123;</span><br><span class="line">    <span class="attribute">display</span>:flow-root;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* ... */</span></span><br></pre></td></tr></table></figure>

<h4 id="position"><a href="#position" class="headerlink" title="position"></a>position</h4><blockquote>
<p>设置left right 等于设置了宽度<br>position:sticky; 子元素达到父元素某个位置时固定住，暂时只支持Firefox </p>
</blockquote>
<h4 id="ul-list-style"><a href="#ul-list-style" class="headerlink" title="ul list-style"></a>ul list-style</h4><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/* list-style-type, list-style-position, list-style-image*/</span></span><br><span class="line"><span class="attribute">list-style</span>:none|其他图形符号(例:decimal数字) <span class="built_in">inside</span>(文本内侧) 自定义图片</span><br></pre></td></tr></table></figure>
<h4 id="initial-和-inherit"><a href="#initial-和-inherit" class="headerlink" title="initial 和 inherit"></a>initial 和 inherit</h4><blockquote>
<p>initial:属性取默认值<br>inherit:属性值从父元素继承</p>
</blockquote>
<p>暂存:background-blend-mode 属性定义了背景层的混合模式（图片与颜色）。<br>    anime.js Mo.js velocity popmotion Hover(css)</p>
<h4 id="font-family"><a href="#font-family" class="headerlink" title="font-family"></a>font-family</h4><h5 id="font-family取值"><a href="#font-family取值" class="headerlink" title="font-family取值"></a><code>font-family</code>取值</h5><ul>
<li><strong>font-family: Arial</strong> ：具体的<code>字体样式</code>，字体族名为 Arial;</li>
<li><strong>font-family: sans-serif</strong>：<code>通用字体族名</code>,备选机制，用于在指定的字体不可用时给出较好的字体</li>
<li><strong>通用字体族名</strong><ul>
<li><a target="_blank" rel="noopener" href="https://www.w3.org/TR/2018/REC-css-fonts-3-20180920/#generic-font-families">css fonts3</a><ul>
<li>serif 衬线字体族</li>
<li>sans-serif 非衬线字体族</li>
<li>monospace 等宽字体，即字体中每个字宽度相同</li>
<li>cursive 草书字体</li>
<li>fantasy 主要是那些具有特殊艺术效果的字体</li>
</ul>
<p> 	</p>
</li>
<li><a target="_blank" rel="noopener" href="https://www.w3.org/TR/css-fonts-4/#generic-font-families">css fonts4 新增</a><ul>
<li>system-ui 系统默认字体</li>
<li>emoji 用于兼容 emoji 表情符号字符</li>
<li>math 适用于数学表达式</li>
<li>fangsong 此字体系列用于中文的（仿宋）字体。</li>
</ul>
</li>
</ul>
</li>
</ul>
<h5 id="常用-通用字体族名"><a href="#常用-通用字体族名" class="headerlink" title="常用 通用字体族名"></a>常用 通用字体族名</h5><ul>
<li><code>系统默认字体（system-ui）</code>，不同的操作系统的 Web 页面下，自动选择本操作系统下的默认系统字体。<ul>
<li>补充 system-ui 兼容性的不足 </li>
<li>支持作为 <strong>-apple-system</strong> 值（仅在 macOS 和 iOS 上）</li>
<li>支持作为 <strong>BlinkMacSystemFont</strong> 值（仅在 macOS 上）</li>
</ul>
<p> 	</p>
</li>
<li><code>Segoe UI</code>， Windows 平台及 Windows Phone 上选取最佳的<strong>西文字体</strong>展示。</li>
<li><code>Roboto</code>，是为 Android 操作系统设计的一个无衬线字体家族</li>
<li><code>衬线字体族（ serif）</code>，在字符笔画末端有叫做衬线额外装饰，笔画的粗细会有所不同</li>
<li><code>无衬线字体族（sans-serif）</code>，通常是统一线条的，往往拥有相同的曲率，笔直的线条，锐利的转角</li>
</ul>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">*&#123;</span><br><span class="line">	<span class="attribute">font-family</span>: system-ui,-apple-system,BlinkMacSystemFont,segoe ui,Roboto,</span><br><span class="line">    Helvetica,Arial,</span><br><span class="line">    sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">/* system-ui,-apple-system,BlinkMacSystemFont,segoe ui,Roboto,具体字体族,sans-serif,可有可无随意;*/</span></span><br></pre></td></tr></table></figure>

<h4 id="对src和href的理解"><a href="#对src和href的理解" class="headerlink" title="对src和href的理解"></a>对src和href的理解</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">它们都可以加载外部文件</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">href 是 <span class="built_in">link</span>和a的属性， 遇到时并行下载，不会停止对文档的处理</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">src  是 js和img的属性， 会暂停其他资源的处理，处理完在继续</span></span><br></pre></td></tr></table></figure>

<h4 id="常见的浏览器兼容问题"><a href="#常见的浏览器兼容问题" class="headerlink" title="常见的浏览器兼容问题"></a>常见的浏览器兼容问题</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">浏览器兼容问题产生的原因</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">   不同浏览器内核不同，渲染解析出的效果有时会又所差异，支持的API会有差异，就是浏览器兼容问题</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">   如：不同浏览器默认内边距不同  或 css3 新的api各个浏览器支持不一致等，早期都有加前缀</span></span><br></pre></td></tr></table></figure>

</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="http://example.com">lzoxun</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="http://example.com/2023/07/22/web/issues/issues-style/">http://example.com/2023/07/22/web/issues/issues-style/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://example.com" target="_blank">学习笔记</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"></div><div class="post_share"><div class="social-share" data-image="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2023/07/22/web/media-webrtc/" title="webrtc"><div class="cover" style="background: var(--default-bg-color)"></div><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">webrtc</div></div></a></div><div class="next-post pull-right"><a href="/2023/07/22/web/issues/issues-vue/" title="vue"><div class="cover" style="background: var(--default-bg-color)"></div><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">vue</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src= "" data-lazy-src="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">lzoxun</div><div class="author-info__description"></div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">108</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">1</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/liaozhongxun"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/liaozhongxun" target="_blank" title="Github"><i class="fab fa-github" style="color: #24292e;"></i></a><a class="social-icon" href="mailto:869664233@gmail.com" target="_blank" title="Email"><i class="fas fa-envelope" style="color: #4a7dbe;"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">这是我的文档</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-4"><a class="toc-link" href="#CSS"><span class="toc-number">1.</span> <span class="toc-text">CSS</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%9D%E5%A7%8B%E5%8C%96"><span class="toc-number">2.</span> <span class="toc-text">初始化</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%8F%AA%E5%9C%A8%E7%81%AB%E7%8B%90%E7%94%9F%E6%95%88"><span class="toc-number">3.</span> <span class="toc-text">只在火狐生效</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%AF%9B%E7%8E%BB%E7%92%83%E6%95%88%E6%9E%9C"><span class="toc-number">4.</span> <span class="toc-text">毛玻璃效果</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%BA%A2%E5%87%BA%E7%9C%81%E7%95%A5"><span class="toc-number">5.</span> <span class="toc-text">溢出省略</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#IOS%E6%BB%9A%E5%8A%A8%E6%BB%91%E5%8A%A8%E4%B8%8D%E9%A1%BA%E7%95%85%E9%97%AE%E9%A2%98"><span class="toc-number">6.</span> <span class="toc-text">IOS滚动滑动不顺畅问题</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%9A%90%E8%97%8F%E8%B0%B7%E6%AD%8C%E6%BB%9A%E5%8A%A8%E6%9D%A1"><span class="toc-number">7.</span> <span class="toc-text">隐藏谷歌滚动条</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%A0%BC%E5%BC%8F%E5%8C%96%E4%B8%8A%E4%B8%8B%E6%96%87-BFC"><span class="toc-number">8.</span> <span class="toc-text">格式化上下文 BFC ?</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%A1%B6%E7%BA%BF%E3%80%81%E4%B8%AD%E7%BA%BF%E3%80%81%E5%9F%BA%E7%BA%BF%E2%80%A6"><span class="toc-number">9.</span> <span class="toc-text">顶线、中线、基线…</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9B%BE%E7%89%87%E5%9C%B0%E9%83%A83%E5%83%8F%E7%B4%A0"><span class="toc-number">10.</span> <span class="toc-text">图片地部3像素</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#cale%E5%8A%A8%E6%80%81%E8%AE%A1%E7%AE%97%E5%80%BC"><span class="toc-number">11.</span> <span class="toc-text">cale动态计算值</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#css%E9%9A%90%E8%97%8F%E5%85%83%E7%B4%A0%E7%9A%84%E6%96%B9%E6%B3%95"><span class="toc-number">12.</span> <span class="toc-text">css隐藏元素的方法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%B8%85%E9%99%A4%E6%B5%AE%E5%8A%A8"><span class="toc-number">13.</span> <span class="toc-text">清除浮动</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#position"><span class="toc-number">14.</span> <span class="toc-text">position</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#ul-list-style"><span class="toc-number">15.</span> <span class="toc-text">ul list-style</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#initial-%E5%92%8C-inherit"><span class="toc-number">16.</span> <span class="toc-text">initial 和 inherit</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#font-family"><span class="toc-number">17.</span> <span class="toc-text">font-family</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#font-family%E5%8F%96%E5%80%BC"><span class="toc-number">17.1.</span> <span class="toc-text">font-family取值</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#%E5%B8%B8%E7%94%A8-%E9%80%9A%E7%94%A8%E5%AD%97%E4%BD%93%E6%97%8F%E5%90%8D"><span class="toc-number">17.2.</span> <span class="toc-text">常用 通用字体族名</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%AF%B9src%E5%92%8Chref%E7%9A%84%E7%90%86%E8%A7%A3"><span class="toc-number">18.</span> <span class="toc-text">对src和href的理解</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%B8%B8%E8%A7%81%E7%9A%84%E6%B5%8F%E8%A7%88%E5%99%A8%E5%85%BC%E5%AE%B9%E9%97%AE%E9%A2%98"><span class="toc-number">19.</span> <span class="toc-text">常见的浏览器兼容问题</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/07/22/window/win-11/" title="win 11 set">win 11 set</a><time datetime="2023-07-22T07:14:09.700Z" title="发表于 2023-07-22 15:14:09">2023-07-22</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/07/22/window/win-gitbash/" title="git bash">git bash</a><time datetime="2023-07-22T07:14:09.700Z" title="发表于 2023-07-22 15:14:09">2023-07-22</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/07/22/window/win-wsl/" title="wsl">wsl</a><time datetime="2023-07-22T07:14:09.700Z" title="发表于 2023-07-22 15:14:09">2023-07-22</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/07/22/window/win-main/" title="window">window</a><time datetime="2023-07-22T07:14:09.700Z" title="发表于 2023-07-22 15:14:09">2023-07-22</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/07/22/web/%E5%85%BC%E5%AE%B9%E9%97%AE%E9%A2%98/" title="兼容问题">兼容问题</a><time datetime="2023-07-22T07:14:09.699Z" title="发表于 2023-07-22 15:14:09">2023-07-22</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By lzoxun</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.umd.min.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script>function panguFn () {
  if (typeof pangu === 'object') pangu.autoSpacingPage()
  else {
    getScript('https://cdn.jsdelivr.net/npm/pangu/dist/browser/pangu.min.js')
      .then(() => {
        pangu.autoSpacingPage()
      })
  }
}

function panguInit () {
  if (false){
    GLOBAL_CONFIG_SITE.isPost && panguFn()
  } else {
    panguFn()
  }
}

document.addEventListener('DOMContentLoaded', panguInit)</script><div class="js-pjax"></div><script id="canvas_nest" defer="defer" color="0,0,255" opacity="0.7" zIndex="-1" count="99" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-nest.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div class="no-result" id="local-search-results"></div><div id="local-search-stats-wrap"></div></div></div><div id="search-mask"></div><script src="/js/search/local-search.js"></script></div></div><script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"log":false,"model":{"jsonPath":"/live2dw/assets/haruto.model.json"},"display":{"position":"right","width":100,"height":200,"right":300},"mobile":{"show":true}});</script></body></html>